import { CoolController, BaseController } from '@cool-midway/core';
import { Body, Inject, Post, Get, Query } from '@midwayjs/core';
import { CollectionInfoEntity } from '../../entity/info';
import { CollectionInfoService } from '../../service/infoType';

/**
 * collection模块-收藏信息
 */
@CoolController({
  prefix: "/apid/action",
  api: ['add', 'delete', 'update', 'info', 'list', 'page'],
  entity: CollectionInfoEntity,
  service: CollectionInfoService,
  pageQueryOp: {
    keyWordLikeFields: ['collectionId', 'userId'],
    fieldEq: ['type', 'status']
  }
})
export class AdminCollectionInfoController extends BaseController {
  @Inject()
  collectionInfoService: CollectionInfoService;
  
  @Post('/updateCollection', { summary: '收藏' })
  async updateCollection(@Body() queryData: any) {
    return this.ok(await this.collectionInfoService.updateCollection(queryData));
  }

  @Get('/getCollect', { summary: '收藏' })
  async getCollect(@Query() queryData: any) {
    return this.ok(await this.collectionInfoService.getCollect(queryData));
  }


}
